import java.util.concurrent.CountDownLatch;

public class MyCountDonwLatch {

    static CountDownLatch countDownLatch = new CountDownLatch(2);

    public static void main(String[] args) throws Exception {

        new Thread(new Runnable() {
            public void run() {
                //System.out.println("开始测试");
                countDownLatch.countDown();
                System.out.println("第一次减一");
                //countDownLatch.countDown();
                //System.out.println("第二次减一");
            }
        }).start();
        countDownLatch.await();
        System.out.println("测试结束！");
    }
}
